package cn.com.cfae.iras.doc.analyze.parse.model.table;

import cn.com.cfae.iras.doc.analyze.keys.ExtractMethod;
import cn.com.cfae.iras.doc.analyze.parse.extractor.*;
import cn.com.cfae.iras.doc.analyze.parse.model.*;
import cn.com.cfae.iras.doc.analyze.parse.model.iaad.*;

import java.util.*;

public class BMTable extends BaseTable {

    public final static String BM0 = "BM-0";
    public final static String BM1 = "BM-1";
    public final static String BM2 = "BM-2";
    public final static String BM3 = "BM-3";
    public final static String BM4 = "BM-4";
    public final static String BM5 = "BM-5";
    public final static String BM6 = "BM-6";
    public final static String BM7 = "BM-7";
    public final static String BM8 = "BM-8";
    public final static String BM9 = "BM-9";
    public final static String BM10 = "BM-10";
    public final static String BM11 = "BM-11";
    public final static String BM12 = "BM-12";
    public final static String BM13 = "BM-13";

    public BMTable() {
        super(TableType.BM);
    }

    public List<String> getSynonyms() {
        List<String> synonyms = new ArrayList<>();
        for (Iterator<String> it = items.keySet().iterator(); it.hasNext(); ) {
            String key = it.next();
            String value = items.get(key);
            synonyms.addAll(Arrays.asList(value.split(SYNONYM_SPLIT_CHAR)));
        }
        return synonyms;
    }

    @Override
    public void initTable() {
        List<TableItem> tableItemList = new ArrayList<>();
        TableItem tableItem = null;
        for (Iterator<String> it = items.keySet().iterator(); it.hasNext(); ) {
            String key = it.next();
            tableItem = new TableItem();
            String[] synonyms = items.get(key).split(SYNONYM_SPLIT_CHAR);
            tableItem.setItemName(synonyms[0]);
            tableItem.setItemNo(key);
            tableItem.setSynonyms(Arrays.asList(synonyms));
            tableItemList.add(tableItem);
            if (subItems.containsKey(key)) {
                List<String> subItems = subTableItemMap.get(key);
                for (int i = 0; i < subItems.size(); i++) {
                    String subItemNo = subItems.get(i);
                    TableItem subTableItem = new TableItem();
                    subTableItem.setItemNo(subItemNo);
                    subTableItem.setItemName(subItemSynonyms.get(subItemNo));
                }
            }
        }
        setTableItemList(tableItemList);
    }

    private Map<String, ExtractBizModel> bm0 = null;
    private Map<String, ExtractBizModel> bm1 = null;
    private Map<String, ExtractBizModel> bm2 = null;
    private Map<String, ExtractBizModel> bm3 = null;
    private Map<String, ExtractBizModel> bm4 = null;
    private Map<String, ExtractBizModel> bm5 = null;
    private Map<String, ExtractBizModel> bm6 = null;
    private Map<String, ExtractBizModel> bm7 = null;
    private Map<String, ExtractBizModel> bm8 = null;
    private Map<String, ExtractBizModel> bm9 = null;
    private Map<String, ExtractBizModel> bm10 = null;
    private Map<String, ExtractBizModel> bm11 = null;
    private Map<String, ExtractBizModel> bm12 = null;
    private Map<String, ExtractBizModel> bm13 = null;

    private static MTable instance = new MTable();

    public static MTable getInstance() {
        return instance;
    }


    public Map<String, ExtractBizModel> getExtractBizModelMap(String tableId) {
        switch (tableId) {
            case BM0:
                return createBM0ExtractBizModel();
            case BM1:
                return createBM1ExtractBizModel();
            case BM2:
                return createBM2ExtractBizModel();
            case BM3:
                return createBM3ExtractBizModel();
            case BM4:
                return createBM4ExtractBizModel();
            case BM5:
                return createBM5ExtractBizModel();
            case BM6:
                return createBM6ExtractBizModel();
            case BM7:
                return createBM7ExtractBizModel();
            case BM8:
                return createBM8ExtractBizModel();
            case BM9:
                return createBM9ExtractBizModel();
            case BM10:
                return createBM10ExtractBizModel();
            case BM11:
                return createBM11ExtractBizModel();
            case BM12:
                return createBM12ExtractBizModel();
            case BM13:
                return createBM13ExtractBizModel();
            default:
                break;
        }
        return null;
    }

    public ExtractBizModel getExtractBizModel(String tableId, String modelName) {
        return getExtractBizModelMap(tableId).get(modelName);
    }


    /**
     * M0（封皮、目录、重要提示）
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM0ExtractBizModel() {
        bm0 = new HashMap<>();
        {
            //M0-封皮-发行人
            ExtractBizModel fxr = new ExtractBizModel();
            fxr.setModelName(FXRModel.MODEL_NAME);
            fxr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fxr.setExtractItemList(FXRModel.createExtractItemList());
            bm0.put(fxr.getModelName(), fxr);
        }

        {
            //M0-封皮-评级机构
            ExtractBizModel xypjjg = new ExtractBizModel();
            xypjjg.setModelName(XYPJJGModel.MODEL_NAME);
            xypjjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            xypjjg.setExtractItemList(XYPJJGModel.createExtractItemList());
            bm0.put(xypjjg.getModelName(), xypjjg);
        }

        {
            //M0-封皮-发行条款
            ExtractBizModel fxtk = new ExtractBizModel();
            fxtk.setModelName(FXTKModel.MODEL_NAME);
            fxtk.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fxtk.setExtractItemList(FXTKModel.createExtractItemList());
            bm0.put(fxtk.getModelName(), fxtk);
        }
        {
            //M0-封皮-主承销商
            ExtractBizModel zcxs = new ExtractBizModel();
            zcxs.setModelName(ZCXSModel.MODEL_NAME);
            zcxs.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            zcxs.setExtractItemList(ZCXSModel.createExtractItemList());
            bm0.put(zcxs.getModelName(), zcxs);
        }
        {
            //M0-重要提示
            ExtractBizModel zyts = new ExtractBizModel();
            zyts.setModelName(ZYTSModel.MODEL_NAME);
            zyts.setExtractMethods(new ExtractMethod[]{ExtractMethod.TEXT});
            zyts.setExtractItemList(ZYTSModel.createExtractItemList());
            bm0.put(zyts.getModelName(), zyts);
        }
        return bm0;
    }

    /**
     * 名词释义
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM1ExtractBizModel() {
        bm1 = new HashMap<>();
        {
            //M1-名词释义
            ExtractBizModel mcsy = new ExtractBizModel();
            mcsy.setModelName(SYModel.MODEL_NAME);
            mcsy.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            mcsy.setExtractItemList(SYModel.createExtractItemList());
            bm1.put(mcsy.getModelName(), mcsy);
        }

        return bm1;
    }

    /**
     * 风险提示及说明
     * //TODO 需要定义模型
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM2ExtractBizModel() {
        bm2 = new HashMap<>();
        {
            //资产负债
            ExtractBizModel zcfz = new ExtractBizModel();
            zcfz.setModelName(ZCFZModel.MODEL_NAME);
            zcfz.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            zcfz.setExtractItemList(ZCFZModel.createExtractItemList());
            bm2.put(zcfz.getModelName(), zcfz);
        }

        {
            //现金流量
            ExtractBizModel xjll = new ExtractBizModel();
            xjll.setModelName(XJLLModel.MODEL_NAME);
            xjll.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            xjll.setExtractItemList(XJLLModel.createExtractItemList());
            bm2.put(xjll.getModelName(), xjll);
        }

        {
            //利润
            ExtractBizModel lr = new ExtractBizModel();
            lr.setModelName(LRModel.MODEL_NAME);
            lr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            lr.setExtractItemList(LRModel.createExtractItemList());
            bm2.put(lr.getModelName(), lr);
        }
        return bm2;
    }

    /**
     * 发行条款
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM3ExtractBizModel() {
        bm3 = new HashMap<>();
        {
            //M3发行条款
            ExtractBizModel fxtk = new ExtractBizModel();
            fxtk.setModelName(FXTKModel.MODEL_NAME);
            fxtk.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fxtk.setExtractItemList(FXTKModel.createExtractItemList());
            bm3.put(fxtk.getModelName(), fxtk);
        }

        {
            //集中簿记建档
            ExtractBizModel jzbjjd = new ExtractBizModel();
            jzbjjd.setModelName(JZBJJDModel.MODEL_NAME);
            jzbjjd.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            jzbjjd.setExtractItemList(JZBJJDModel.createExtractItemList());
            bm3.put(jzbjjd.getModelName(), jzbjjd);
        }

        {
            //缴款结算
            ExtractBizModel jkjs = new ExtractBizModel();
            jkjs.setModelName(JKJSModel.MODEL_NAME);
            jkjs.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            jkjs.setExtractItemList(JKJSModel.createExtractItemList());
            bm3.put(jkjs.getModelName(), jkjs);
        }

        {
            //
            ExtractBizModel sslt = new ExtractBizModel();
            sslt.setModelName(SSLTModel.MODEL_NAME);
            sslt.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            sslt.setExtractItemList(SSLTModel.createExtractItemList());
            bm3.put(sslt.getModelName(), sslt);
        }
        return bm3;
    }


    /**
     * 募集资金用途
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM4ExtractBizModel() {
        bm4 = new HashMap<>();
        {
            //募集资金用途
            ExtractBizModel mjzjyt = new ExtractBizModel();
            mjzjyt.setModelName(MJZJYTModel.MODEL_NAME);
            mjzjyt.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            mjzjyt.setExtractItemList(MJZJYTModel.createExtractItemList());
            bm4.put(mjzjyt.getModelName(), mjzjyt);
        }

        {
            //有息债务
            ExtractBizModel yxzw = new ExtractBizModel();
            yxzw.setModelName(YXZWModel.MODEL_NAME);
            yxzw.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            yxzw.setExtractItemList(YXZWModel.createExtractItemList());
            bm4.put(yxzw.getModelName(), yxzw);
        }
        return bm4;
    }


    /**
     * 发行人基本状况
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM5ExtractBizModel() {
        bm5 = new HashMap<>();
        {
            //发行人基本信息
            ExtractBizModel fxr = new ExtractBizModel();
            fxr.setModelName(FXRModel.MODEL_NAME);
            fxr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fxr.setExtractItemList(FXRModel.createExtractItemList());
            bm5.put(fxr.getModelName(), fxr);
        }
        {
            //董监高
            ExtractBizModel djg = new ExtractBizModel();
            djg.setModelName(DJGModel.MODEL_NAME);
            djg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            djg.setExtractItemList(DJGModel.createExtractItemList());
            bm5.put(djg.getModelName(), djg);
        }

        {
            //董事会
            ExtractBizModel dsh = new ExtractBizModel();
            dsh.setModelName(DSHModel.MODEL_NAME);
            dsh.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            dsh.setExtractItemList(DSHModel.createExtractItemList());
            bm5.put(dsh.getModelName(), dsh);
        }

        {
            //监事会
            ExtractBizModel jsh = new ExtractBizModel();
            jsh.setModelName(JSHModel.MODEL_NAME);
            jsh.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            jsh.setExtractItemList(JSHModel.createExtractItemList());
            bm5.put(jsh.getModelName(), jsh);
        }

        {
            //高管
            ExtractBizModel gg = new ExtractBizModel();
            gg.setModelName(GGModel.MODEL_NAME);
            gg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            gg.setExtractItemList(GGModel.createExtractItemList());
            bm5.put(gg.getModelName(), gg);
        }

        {
            //营业收入
            ExtractBizModel yysr = new ExtractBizModel();
            yysr.setModelName(YYSRModel.MODEL_NAME);
            yysr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            yysr.setExtractItemList(YYSRModel.createExtractItemList());
            bm5.put(yysr.getModelName(), yysr);
        }
        {
            //营业成本
            ExtractBizModel yycb = new ExtractBizModel();
            yycb.setModelName(YYCBModel.MODEL_NAME);
            yycb.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            yycb.setExtractItemList(YYCBModel.createExtractItemList());
            bm5.put(yycb.getModelName(), yycb);
        }
        {
            //毛利润
            ExtractBizModel mlr = new ExtractBizModel();
            mlr.setModelName(MLRModel.MODEL_NAME);
            mlr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            mlr.setExtractItemList(MLRModel.createExtractItemList());
            bm5.put(mlr.getModelName(), mlr);
        }
        {
            //毛利率
            ExtractBizModel mll = new ExtractBizModel();
            mll.setModelName(MLLModel.MODEL_NAME);
            mll.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            mll.setExtractItemList(MLLModel.createExtractItemList());
            bm5.put(mll.getModelName(), mll);
        }

        {
            //在建工程
            ExtractBizModel zjgc = new ExtractBizModel();
            zjgc.setModelName(ZJGCModel.MODEL_NAME);
            zjgc.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            zjgc.setExtractItemList(ZJGCModel.createExtractItemList());
            bm5.put(zjgc.getModelName(), zjgc);
        }
        {
            //已完工
            ExtractBizModel ywcgc = new ExtractBizModel();
            ywcgc.setModelName(YWGXMModel.MODEL_NAME);
            ywcgc.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            ywcgc.setExtractItemList(YWGXMModel.createExtractItemList());
            bm5.put(ywcgc.getModelName(), ywcgc);
        }

        {
            //火电
            ExtractBizModel hd = new ExtractBizModel();
            hd.setModelName(HDModel.MODEL_NAME);
            hd.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            hd.setExtractItemList(HDModel.createExtractItemList());
            bm5.put(HDModel.MODEL_NAME, hd);
        }
        {
            //高速公路
            ExtractBizModel gsgl = new ExtractBizModel();
            gsgl.setModelName(GSGLModel.MODEL_NAME);
            gsgl.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            gsgl.setExtractItemList(GSGLModel.createExtractItemList());
            bm5.put(gsgl.getModelName(), gsgl);
        }

        {
            //水泥
            ExtractBizModel sn = new ExtractBizModel();
            sn.setModelName(SNModel.MODEL_NAME);
            sn.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            sn.setExtractItemList(SNModel.createExtractItemList());
            bm5.put(sn.getModelName(), sn);
        }

        {
            //煤炭
            ExtractBizModel mt = new ExtractBizModel();
            mt.setModelName(MTModel.MODEL_NAME);
            mt.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            mt.setExtractItemList(MTModel.createExtractItemList());
            bm5.put(mt.getModelName(), mt);
        }

        {
            //钢铁
            ExtractBizModel gt = new ExtractBizModel();
            gt.setModelName(GTModel.MODEL_NAME);
            gt.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            gt.setExtractItemList(GTModel.createExtractItemList());
            bm5.put(gt.getModelName(), gt);
        }

        {
            //房地产
            ExtractBizModel fdc = new ExtractBizModel();
            fdc.setModelName(FDCModel.MODEL_NAME);
            fdc.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fdc.setExtractItemList(FDCModel.createExtractItemList());
            bm5.put(fdc.getModelName(), fdc);
        }
        return bm5;
    }


    /**
     * 财务状况
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM6ExtractBizModel() {
        bm6 = new HashMap<>();
        {
            //资产负债
            ExtractBizModel zcfz = new ExtractBizModel();
            zcfz.setModelName(ZCFZModel.MODEL_NAME);
            zcfz.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            zcfz.setExtractItemList(ZCFZModel.createExtractItemList());
            bm6.put(zcfz.getModelName(), zcfz);
        }

        {
            //现金流量
            ExtractBizModel xjll = new ExtractBizModel();
            xjll.setModelName(XJLLModel.MODEL_NAME);
            xjll.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            xjll.setExtractItemList(XJLLModel.createExtractItemList());
            bm6.put(xjll.getModelName(), xjll);
        }

        {
            //利润
            ExtractBizModel lr = new ExtractBizModel();
            lr.setModelName(LRModel.MODEL_NAME);
            lr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            lr.setExtractItemList(LRModel.createExtractItemList());
            bm6.put(lr.getModelName(), lr);
        }

        {
            //偿债能力
            ExtractBizModel cznl = new ExtractBizModel();
            cznl.setModelName(CZNLModel.MODEL_NAME);
            cznl.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            cznl.setExtractItemList(CZNLModel.createExtractItemList());
            bm6.put(cznl.getModelName(), cznl);
        }

        {
            //盈利能力
            ExtractBizModel ylnl = new ExtractBizModel();
            ylnl.setModelName(YLNLModel.MODEL_NAME);
            ylnl.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            ylnl.setExtractItemList(YLNLModel.createExtractItemList());
            bm6.put(ylnl.getModelName(), ylnl);
        }

        {
            //运营能力
            ExtractBizModel yynl = new ExtractBizModel();
            yynl.setModelName(YYNLModel.MODEL_NAME);
            yynl.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            yynl.setExtractItemList(YYNLModel.createExtractItemList());
            bm6.put(yynl.getModelName(), yynl);
        }

        {
            //对外担保金额
            ExtractBizModel dwdb = new ExtractBizModel();
            dwdb.setModelName(DWDBModel.MODEL_NAME);
            dwdb.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            dwdb.setExtractItemList(DWDBModel.createExtractItemList());
            bm6.put(dwdb.getModelName(), dwdb);
        }

        {
            //受限资产
            ExtractBizModel sxzc = new ExtractBizModel();
            sxzc.setModelName(SXZCModel.MODEL_NAME);
            sxzc.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            sxzc.setExtractItemList(SXZCModel.createExtractItemList());
            bm6.put(sxzc.getModelName(), sxzc);
        }
        return bm6;
    }


    /**
     * 企业资信状况
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM7ExtractBizModel() {
        bm7 = new HashMap<>();
        {
            //
            ExtractBizModel xypjjg = new ExtractBizModel();
            xypjjg.setModelName(XYPJJGModel.MODEL_NAME);
            xypjjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            xypjjg.setExtractItemList(XYPJJGModel.createExtractItemList());
            bm7.put(xypjjg.getModelName(), xypjjg);
        }

        {
            //
            ExtractBizModel sx = new ExtractBizModel();
            sx.setModelName(SXModel.MODEL_NAME);
            sx.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            sx.setExtractItemList(SXModel.createExtractItemList());
            bm7.put(sx.getModelName(), sx);
        }
        return bm7;
    }


    /**
     * 债务融资工具信用增进
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM8ExtractBizModel() {
        bm8 = new HashMap<>();
        {
            ExtractBizModel xyzjjg = new ExtractBizModel();
            xyzjjg.setModelName(XYZJJGModel.MODEL_NAME);
            xyzjjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            xyzjjg.setExtractItemList(XYZJJGModel.createExtractItemList());
            bm8.put(xyzjjg.getModelName(), xyzjjg);
        }
        {
            ExtractBizModel dwdb = new ExtractBizModel();
            dwdb.setModelName(DWDBModel.MODEL_NAME);
            dwdb.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            dwdb.setExtractItemList(DWDBModel.createExtractItemList());
            bm8.put(dwdb.getModelName(), dwdb);
        }

        {
            ExtractBizModel zcfz = new ExtractBizModel();
            zcfz.setModelName(ZCFZModel.MODEL_NAME);
            zcfz.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            zcfz.setExtractItemList(ZCFZModel.createExtractItemList());
            bm8.put(zcfz.getModelName(), zcfz);
        }

        return bm8;
    }


    /**
     * 税项
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM9ExtractBizModel() {
        bm9 = new HashMap<>();
        {

        }

        return bm9;
    }


    /**
     * 定期信息披露
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM10ExtractBizModel() {
        bm10 = new HashMap<>();
        {

        }

        return bm10;
    }


    /**
     * 投资人保护条款
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM11ExtractBizModel() {
        bm11 = new HashMap<>();
        {

        }

        return bm11;
    }

    /**
     * 发行有关机构
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM12ExtractBizModel() {
        bm12 = new HashMap<>();
        {
            //发行机构
            ExtractBizModel fxjg = new ExtractBizModel();
            fxjg.setModelName(FXJGModel.MODEL_NAME);
            fxjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fxjg.setExtractItemList(FXJGModel.createExtractItemList());
            bm12.put(fxjg.getModelName(), fxjg);
        }
        {
            //发行人
            ExtractBizModel fxr = new ExtractBizModel();
            fxr.setModelName(FXRModel.MODEL_NAME);
            fxr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fxr.setExtractItemList(FXRModel.createExtractItemList());
            bm12.put(fxr.getModelName(), fxr);
        }

        {
            //律师事务所
            ExtractBizModel lssws = new ExtractBizModel();
            lssws.setModelName(LSSWSModel.MODEL_NAME);
            lssws.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            lssws.setExtractItemList(LSSWSModel.createExtractItemList());
            bm12.put(lssws.getModelName(), lssws);
        }

        {
            //主承销商
            ExtractBizModel zcxs = new ExtractBizModel();
            zcxs.setModelName(ZCXSModel.MODEL_NAME);
            zcxs.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            zcxs.setExtractItemList(ZCXSModel.createExtractItemList());
            bm12.put(zcxs.getModelName(), zcxs);
        }

        {
            //审计事务所
            ExtractBizModel sjsws = new ExtractBizModel();
            sjsws.setModelName(SJSWSModel.MODEL_NAME);
            sjsws.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            sjsws.setExtractItemList(SJSWSModel.createExtractItemList());
            bm12.put(sjsws.getModelName(), sjsws);
        }
        {
            //信用评级机构
            ExtractBizModel xypjjg = new ExtractBizModel();
            xypjjg.setModelName(XYPJJGModel.MODEL_NAME);
            xypjjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            xypjjg.setExtractItemList(XYPJJGModel.createExtractItemList());
            bm12.put(xypjjg.getModelName(), xypjjg);
        }

        {
            //登记托管
            ExtractBizModel djtgjg = new ExtractBizModel();
            djtgjg.setModelName(DJTGJGModel.MODEL_NAME);
            djtgjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            djtgjg.setExtractItemList(DJTGJGModel.createExtractItemList());
            bm12.put(djtgjg.getModelName(), djtgjg);
        }

        {
            //集中簿记建档
            ExtractBizModel jzbjjdjg = new ExtractBizModel();
            jzbjjdjg.setModelName(JZBJJDJGModel.MODEL_NAME);
            jzbjjdjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            jzbjjdjg.setExtractItemList(JZBJJDJGModel.createExtractItemList());
            bm12.put(jzbjjdjg.getModelName(), jzbjjdjg);
        }
        {
            //信用增进机构
            ExtractBizModel xyzjjg = new ExtractBizModel();
            xyzjjg.setModelName(XYZJJGModel.MODEL_NAME);
            xyzjjg.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            xyzjjg.setExtractItemList(XYZJJGModel.createExtractItemList());
            bm12.put(xyzjjg.getModelName(), xyzjjg);
        }

        return bm12;
    }

    /**
     * 备查文件
     *
     * @return
     */
    private Map<String, ExtractBizModel> createBM13ExtractBizModel() {
        bm13 = new HashMap<>();
        {
            //M13-主承销商
            ExtractBizModel zcxs = new ExtractBizModel();
            zcxs.setModelName(ZCXSModel.MODEL_NAME);
            zcxs.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            zcxs.setExtractItemList(ZCXSModel.createExtractItemList());
            bm13.put(zcxs.getModelName(), zcxs);
        }
        {
            //M13-发行人
            ExtractBizModel fxr = new ExtractBizModel();
            fxr.setModelName(FXRModel.MODEL_NAME);
            fxr.setExtractMethods(new ExtractMethod[]{ExtractMethod.KV, ExtractMethod.TABLE});
            fxr.setExtractItemList(FXRModel.createExtractItemList());
            bm13.put(fxr.getModelName(), fxr);
        }
        return bm13;
    }

    private static Map<String, Class<? extends MTableExtractor>> extractorMap = new LinkedHashMap<String, Class<? extends MTableExtractor>>();
    static Map<String, String> items = new LinkedHashMap<>();
    static Map<String, List<String>> subTableItemMap = new HashMap<>();

    static Map<String, String> subItems = new HashMap<>();
    static Map<String, String> subItemSynonyms = new HashMap<>();

    static {
        subItems.put("BM-6-2", "财务数据|会计科目分析");
        items.put(BMTable.BM0, "扉页");
        items.put(BMTable.BM1, "释义");
        items.put(BMTable.BM2, "风险提示及说明|风险提示|投资风险提示");
        items.put(BMTable.BM3, "发行条款|发行安排");
        items.put(BMTable.BM4, "募集资金运用|募集资金用途|募集资金主要用途|募集资金的运用|募集资金的用途|募集资金使用");
        items.put(BMTable.BM5, "企业基本情况|发行人基本情况|公司基本情况|基本情况");
        items.put(BMTable.BM6, "企业主要财务状况|主要财务状况|财务情况|财务状况");
        items.put(BMTable.BM7, "企业资信状况|发行人资信状况|发行人资信状况|资信情况|资信状况");
        items.put(BMTable.BM8, "债务融资工具信用增进|信用增进情况|担保|担保状况|信用增进|担保情况|信用增信");
        items.put(BMTable.BM9, "税项|税务事项");
        items.put(BMTable.BM10, "信息披露安排|定期信息披露|信息披露工作安排|信息披露");
        items.put(BMTable.BM11, "投资者保护机制|违约责任和投资者保护机制|投资人保护机制|违约责任与投资者保护|投资者保护和违约责任|投资者保护|违约责任");
        items.put(BMTable.BM12, "发行有关机构|有关机构|发行有关的机构|发行主要机构|发行相关的机构");
        items.put(BMTable.BM13, "备查文件");

        subTableItemMap.put(BM6, Arrays.asList(new String[]{"BM-6-2"}));

        extractorMap.put(BMTable.BM0, M0Extractor.class);
        extractorMap.put(BMTable.BM1, M1Extractor.class);
        extractorMap.put(BMTable.BM2, M2Extractor.class);
        extractorMap.put(BMTable.BM3, M3Extractor.class);
        extractorMap.put(BMTable.BM4, M4Extractor.class);
        extractorMap.put(BMTable.BM5, M5Extractor.class);
        extractorMap.put(BMTable.BM6, M6Extractor.class);
        extractorMap.put(BMTable.BM7, M7Extractor.class);
        extractorMap.put(BMTable.BM8, M8Extractor.class);
        extractorMap.put(BMTable.BM9, M9Extractor.class);
        extractorMap.put(BMTable.BM10, M10Extractor.class);
        extractorMap.put(BMTable.BM11, M11Extractor.class);
        extractorMap.put(BMTable.BM12, M12Extractor.class);
        extractorMap.put(BMTable.BM13, M13Extractor.class);
    }


    public List<String> getFilters(){
        List<String>filters = new ArrayList<>();
        filters.add(BM0);
        return filters;
    }
    @Override
    public Map<String, Class<? extends MTableExtractor>> createMTableExtractors() {
        return extractorMap;
    }
}
